using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Collections.Generic;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using UIProcessSchemaObjects;

namespace UIProcessSchemaObjects
{
    [ExternalDataExchangeAttribute()]
    public interface IProcessFormService
    {
        void ReturnForm(Form returnedForm);

        event EventHandler<FormEventArgs> FormSubmitted;
    }

    [Serializable]
    public class FormEventArgs : ExternalDataEventArgs
    {
        public FormEventArgs(System.Guid InstanceId)
            : base(InstanceId)
        {
        }

        private Form theForm;

        public Form TheForm
        {
            get { return theForm; }
            set { theForm = value; }
        }
    }

    public class ProcessFormDataExchangeService : IProcessFormService
    {
        private Form _returnedForm;

        public Form ReturnedForm
        {
            get { return _returnedForm; }
            set { _returnedForm = value; }
        }

        public void RaiseFormSubmittedEvent(object sender, FormEventArgs e)
        {
            // Raise the ExpenseReportSubmitted event
            if (this.FormSubmitted != null)
                this.FormSubmitted(sender, e);
        }

        #region IProcessFormService Members

        public void ReturnForm(Form returnedForm)
        {
            _returnedForm = returnedForm;
        }

        public event EventHandler<FormEventArgs> FormSubmitted;

        #endregion
    }
}
